Wednesday, October 05, 2005

Google Maps in Blogger: Embedded Maps

This is part of my tutorial on how to use Google Maps into Google's Blogger service. This section teaches The Embedded Method.

Google has now automated this so it is super easy to do now. My old instructions from 2005 are now obsolete.

Step 1 - Create a Google map
Go to Google Maps (maps.google.com) and create the map you want. Drop in the elements you want (place markers, etc). The tools Google has placed there make it really easy to use.

You don't have to make the map public.

Step 2 - Grab the HTML to imbed from Google Maps
From Google Maps:
  • Edit your map
  • Click "Link" command (upper right side). A small dropdown panel appears under the command.
  • Click "Customize and preview embedded map". A new browser windows pops open.
  • For "Step 1 - Customize", choose "custom" and set both width and height to 400.
  • For "Step 3 - Copy and paste this HTML to embed in your website", do that. Select the HTML it presents in the box and copy it (Windows users can press Control-C, Mac users can press Command-C).
Step 3 - Create A Post
Now we will create a blog post that contains the map. Create a new post, go into "Edit HTML" mode, and paste the code from step 2.

That is it!

Now let's tweak the map to show your content!

If you carefully examine the HTML you copy and pasted from Google Maps, you will see that it mostly consists of just two HTML commands, a <iframe> and a <a>.

Both commands have an attribute with the exact same value. The <iframe> has a "src=" attribute, and the <a> has an "href=" attribute.

The values for both attributes are the same, a URL to your customer map. The URL consists of a location "http://maps.google.com/maps/ms?" followed by a number of name/value pair arguments.

In order to further tweak the map, we will be adding to or altering the values of some of these argument name/value pairs. Make the same changes to both URL's so they are consistent.

Step 4 - Update Target Coordinates
You need to tell Google Maps where on earth it should display. Do this with the latitude and longitude of the location of what you want to look at (your target). Read the chapter on Geocaching on how to get the coordinates. They need to be in decimal format. For example, the coordinates of Monterey, California used are latitude=36.610429, longitude=-121.896143. Notice that the numbers can be positive or negative. Six decimal places of precision of plenty for Google Maps. Any more than 6 digits is overkill.

Edit the post with the map in HTML mode. In there you will see occurrences of the following Javascript statements:

The actual values are from your custom map. Replace the values with your coordinates, then publish the blog post. View the post. It should now be looking at your target.

For example: 51.502332,-0.153122 shows London, England.

Step 5 - Set Zoom Factor
You also need to tell Google Earth what zoom factor to use. This is an integer from 0 to about 20. Increase it zoom in closer. Decrease it to zoom out ('0' shows the whole earth!). I've found that a value of 14 is a good place to start.

Edit the post with the map in HTML mode. In there you will see the Javascript statement:

Replace 14 with your desired value, then publish the blog post. View the post. It should now be looking at your target at the scale you want. Keep tweaking the zoom until you get it the way you want.

Step 6 (Optional) - Change Map Type
Sets the type of map you want to display... Map, Satellite, or Hybrid. Right now it is set to Map.

Edit the post with the map in HTML mode. You will need to add a URL argument to the <iframe> source attribute.

The last argument in both the iframe and href attributes is:

You need to add another argument to the line... The "T=?" argument.


The available options are "m" map, "k" satellite, "h" hybrid, "p" terrain. Replace ? with one of the following values then publish the blog post. View the post.
  • For a map image use m
  • For a satellite image use k
  • For a hybrid image use h
  • For a terrain image use p
Step 9 (Optional) - Resize Map
The dimensions of the map are specified in the <iframe> tag. I recommend 400 x 400 pixels, which I find fits perfect in Blogger's blogs. However, if you want to change the size, then knock yourself out.

Edit the post with the map in HTML mode. In there you will see the HTML statement

Replace 400 with the width and hieght you desire. Then publish the blog post and view the post to see how it looks.

Publish the blog post. View the post. It should all be working now!
If you have some problems, click here for some advanced tutorial.


View Monterey in a larger map

OK Bush... this has gone too far!

Harriet Miers
Harriet Miers
Man! I can't believe Bush has the odacity to nominate a personal friend with no bench experience to fill O'Connors slot on the US Supreme Court. So was she walking by your office when you read the memo that you had to nominate a new Supreme Court justice and you decided to give her the job?

It is well know, and unofficially excepted, that there is political patronage in the US. But this has been limited to repaying your buddies by sticking them in positions where they can do the least amount of damange, like being the embassador to Trinidad or something plum posting.

Putting his pal "Brownie" in charge of FEMA proved to be a disaster. Now he wants his personal lawyer to sit on the bench of the highest court of the land. Get real.

I can only pray that Congress and the Sentate have the backbone to reject this bullshit and demand someone who is qualified for the job.

Monday, October 03, 2005

You don't have to go home. But you can't stay here

One the popular things to do in Perth is to attend the Sunday Sessions in Cottesloe. There are two pubs facing the ocean in Cottesloe. They are The Cottesloe Hotel, better known as "The Cott". And there is the Ocean Beach Hotel, better known as "The OBH", or "The Oh-bee". The Cott is more famous, especially amoung backpackers.

Starting around 3pm on Sunday, everyone seems to work their way down to one of these two hotels for some serious beer drinking. They get absolutely jammed packed by sundown, with a long line of people waiting to get in. Inside is it hot and noisy, and there is no room to move. It is almost impossible to get near a bar to order a drink. And if you do get to the bar, it is impossible to get a bartender to pay attention to you. The crowds consist of mostly young drinkers under 30. The Cott gets the real young crowd, what we would consider a college crowd in the US. The OBH gets an older crowd, but sometimes more wild.

Both pubs close at 10pm on Sunday. Suddenly at 10pm on Sunday nights there are 2000 very drunk people pushed out into the street as the bars close their doors for the night.

My new home is one block from the OBH. It is very quiet. But I have noticed that between 10pm and midnight on Sundays it gets very noisy. All these drunk kids scatter all over the neighborhood looking for rides, their cars, taxis, or God knows what. So I've taken to sitting out on my upstairs patio with a cold beer and watch the drunk loonies go by. It is very entertaining, sort of like a mini Mardi Gras every week for two hours. Guys (and girls), get into very loud discussions or arguments as they stumble down the street. The drunk girls come by and flash anyone who asks, then fall over laughing so hard. I've lost count of how many had forgotten they don't have panties on (or they lost them sometime during the evening).

Who needs TV?

Bali Bombing - why?

In response to the suicide bombings in Bali this weekend, I read and heard the usual knee-jerk reactions of blaming it on Australia backing of the US invasion of Afghanistan and Iraq. However, I read an excellent letter to the editor in today's "The Australian" newspaper which offers an alternate reason to consider. The writer brought up, what I think is, an interesting point about the motives behind this violence, which makes a lot of sense.

Indonesia is the world's most populous Islamic nation. But unlike other Islamic nations in the Middle East, Indonesia (and Malaysia too), has a history and tradition of tolerance for other faiths. Within South East Asia, there are millions of Buddhist, Hindus, Christians, and other faiths. Parts of Indonesia are very strictly Islamic, particulars the largest and most populated islands of Sumatra and Java. The island of Bali is different. The Balinese are Hindu. That is one of the reasons why Bali is so different the rest of Indonesia.

But Indonesia has been afflicted with the same problem as The Balkins. Religious and ethnic fault lines are tearing apart the country. The eastern islands of Indonesia are taking the brunt of this conflict. For years there have been an escalating massacres between Muslim and Christian villages, where the people of one village attack and kill everyone in another village simply because of their faith.

What has happened over the last 10 years is that more and more Muslim Indonesians from the western and overpopulated part of the country, such as Java, have been relocated, into the eastern provinces where Islam is not the majority. They feel out of the element. They are then exploited by extremists trained in the Middle East to convert their frustration into a hatred of all who are not of their faith.

Indonesia has always had a hard-core Islamic faction that wants to impose a pan-Islamic rule over all of South East Asia. These people view the Hindu Balinies not as fellow citizens of Indonesia, but as infidels who are standing in the way of the Asian Islamic state.

These bombings are not a war on "the west". They are a war on Bali by fellow Indonesians who want Bali to become another Islamic island. The bombings are part of a camaign to destroy the economy of Bali by driving off the tourist. They want to force Bali to convert, and using terror and violence is an acceptable method to covert people to Islam, according to the new generation of militants being led by nuts from Saudi Arabia and Pakistan.